﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Vue.H5.Authorization.Controllers
{
    public class ErrorController : Controller
    {
        private readonly IIdentityServerInteractionService _interaction;
        private readonly ILogger logger;

        public ErrorController(IIdentityServerInteractionService interaction, ILogger<ErrorController> _logger)
        {
            _interaction = interaction;
            logger = _logger;
        }
        [Route("/error")]
        public async Task Index(string errorId)
        {
           var message=await _interaction.GetErrorContextAsync(errorId);
            logger.LogError(message.ErrorDescription);
        }
    }
}
